<?php
/**
 * Created by PhpStorm.
 * User: david
 * Date: 2018/6/20
 * Time: 11:21
 */

namespace app\admin\controller;


use app\admin\Controller;
use app\common\model\ZcjyImg as ZcjyImgModel;
use traits\controller\Jump;

class Zcjy extends Controller
{
    use \app\admin\traits\controller\Controller;
    use Jump;

    public function imgs()
    {
        if ($this->request->isGet()) {
            $imgs = ZcjyImgModel::getImgsByPid($this->request->param('id'));
            $this->view->assign('id', $this->request->param('id'));
            $this->view->assign('imgs', $imgs);
            return $this->view->fetch('img');
        } else {
            $data = $this->request->param();
            ZcjyImgModel::create($data);
            return $this->success('添加成功');
        }
    }

    public function imgdel()
    {
        $id = $this->request->param('id');
        ZcjyImgModel::destroy($id);
        return ajax_return_adv('删除成功', '');
    }
}